/**
 * @file PointAndCircleNoFriend.cpp
 * @author redfrogotr
 * @brief 点与圆，成员函数实现判断点与圆关系
 * @date 2022-03-20
 */

#include <iostream>
#include <cstdio>
#include <cmath>

using namespace std;

class Point {
private:
    int x, y;

public:
    Point(int x = 0, int y = 0) : x(x), y(y) {}
    void setX(int x) { this->x = x; }
    void setY(int y) { this->y = y; }
    int getX() { return x; }
    int getY() { return y; }
    void show() {
        printf("Point(%d, %d)\n", x, y);
    }
    double distance(const Point& p) {
        return sqrt(pow(this->x - p.x, 2) + pow(this->y - p.y, 2));
    }
};

class Circle {
private:
    Point center;
    double radium;

    static double PI;

public:
    Circle(const Point& center, double radium = 0) : center(center), radium(radium) {}
    Circle(int x = 0, int y = 0, double radium = 0) : center(x, y), radium(radium) {}
    /*
    set get ...
    */
    void show() {
        printf("Circle{ center(%d, %d), radium(%lf) }\n", center.getX(), center.getY(), radium);
    }
    double area() {
        return PI * radium * radium;
    }
    bool judge(const Point& p) {
        double distance = this->center.distance(p);
        return distance < this->radium || abs(distance - this->radium) < 1e-6;
    } 
};

double Circle::PI = 3.14159;

int main(int argc, char const *argv[]) 
{
    int x, y;
    int cx, cy;
    double r;

    cout << "Point(x, y): " << endl;
    cin >> x >> y;
    cout << "Circle(x, y, r): " << endl;
    cin >> cx >> cy >> r;

    Point p(x, y), center(cx, cy);
    Circle c(center, r), c2(cx, cy, r);

    p.show();
    c.show();
    c2.show();

    printf("Relation: point %s the circle\n", c.judge(p) ? "inside" : "outside");
    
    return 0;
}
